package no14.classtype;

class Car {
}

class Bus extends Car {
}
class Jeep extends Car {
}

public class InstanceOf{
	public static void main(String[] args) {
		Car car = new Jeep();
		if (car instanceof Car) {
			System.out.println("this is Car");
		}
		if (car instanceof Bus) {
			System.out.println("this is Bus");
		}
		//保证下转型不出错,使用instanceof 进行检查
		if (car instanceof Jeep) {
			System.out.println("this is Jeep");
		}
		
		
	}
}